#!/usr/bin/python

import random, copy, sys

nbClauses = int(sys.argv[1])
nbVariables = int(sys.argv[2])

print nbVariables
print nbClauses

x = range(-nbVariables, nbVariables)
x.remove(0)

for i in range(0,nbClauses):

	y = copy.copy(x)	
	rnd = []
	for j in range(0, 3):
		r = random.choice(y)
		rnd.append(str(r))
		y.remove(r)
	print ",".join(rnd)

		
